#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 1005;

int n, m;
int a[N];
int mn[N];
int g[N][N];
int c[N];
void dfs(int u, int fu, int clr) {
  c[u] = clr;
  rep(v, 1, n) {
    if (v == fu) continue;
    if (g[u][v]) {
      if (c[v] == c[u]) {
        cout << 0;
        exit(0);
      } else if (!c[v]) {
        dfs(v, u, 3 - clr);
      }
    }
  }
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  rep(i, 1, n) cin >> a[i];
  mn[n] = n;
  per(i, n - 1, 1) {
    mn[i] = mn[i + 1];
    if (a[i] < a[mn[i]]) mn[i] = i;
  }
  rep(i, 1, n - 1) rep(j, i + 1, n - 1) {
    int k = mn[j + 1];
    if (a[i] < a[j] && a[k] < a[i]) g[i][j] = g[j][i] = 1;
  }
  rep(i, 1, n) {
    if (!c[i]) dfs(i, i, 1);
  }
  a[n + 1] = n + 1;
  mn[n + 1] = n + 1;
  per(i, n, 1) {
    mn[i] = mn[i + 1];
    if (c[i] == 1 && a[i] < a[mn[i]]) mn[i] = i;
  }
  int now = 1, pos = 1;
  stack<int> st1, st2;
  while (now <= n) {
    if (st1.size() && st1.top() == now) {
      cout << "b ";
      st1.pop();
      now++;
      continue;
    }
    if (c[pos] == 1 && (st1.empty() || st1.top() > a[pos])) {
      cout << "a ";
      st1.push(a[pos++]);
      continue;
    }
    if (st2.size() && st2.top() == now) {
      cout << "d ";
      st2.pop();
      now++;
      continue;
    }
    if (c[pos] == 1) {
      cout << "a ";
      st1.push(a[pos++]);
    } else {
      cout << "c ";
      st2.push(a[pos++]);
    }
  }

  return 0;
}